<%@ page pageEncoding="utf-8" %>
<html>
<head>
    <title>登录</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<h2>欢迎登录！</h2>
<form id="login">
    <p>输入口令：<input type="text" id="userName"/></p>
    <input type="button" id="submit" onclick="check()" value="登录">
    <p id="result"></p>
</form>
</body>
<script type="text/javascript">
    function check() {
        const userName = $("#userName").val();
        $.ajax({
            url:"/lovebaby/login/checkUserName",
            data:{
                userName:userName,
            },
            success:function (result) {
                if (result){
                    $("#result").val("yes")
                }else $("#result").val("no")
            }
        })
    }
</script>
</html>
